const http = require('http')
const fs = require('fs')
const path = require('path')
const server1Port = 3000
http
  .createServer((req, res) => {
    console.log(req.url, '请求参数')
    // 访问 http://localhost:3000/ 返回静态 html
    if (req.url === '/') {
      const html = fs.readFileSync(path.resolve(__dirname, 'src/index.html'))
      res.write(html)
    }
  })
  .listen(server1Port, () => {
    console.log('server1 启动在', server1Port, '端口')
  })
